<?php 
	class Info extends CI_Controller{
		public function __construct(){
			parent::__construct();
		}
		
		public function about($str=""){
			//$str = "anwar_Ibrahim";
			$arr = array();
			$this->db->where("name",$str);
			$row = $this->db->get("mobile_customer")->row();
			$tmp['img']		=$row->img;
			$tmp['desc']		=stripslashes($row->description_th);
			$arr[] = $tmp;
			echo json_encode($arr);
		}
		
		public function social($str=""){
			//$str = "anwar_Ibrahim";
			$arr = array();
			$this->db->where("name",$str);
			$row = $this->db->get("mobile_customer")->row();
			$tmp['facebook']	="http://".$row->facebook;
			$tmp['twitter']		="https://".$row->twitter;
			$tmp['social']			="";
			$arr[] = $tmp;
			echo json_encode($arr);
		}
		
		public function contact($str=""){
			//$str = "anwar_Ibrahim";
			$arr = array();
			$this->db->where("name",$str);
			$row = $this->db->get("mobile_customer")->row();
			$tmp['address']			=stripslashes($row->address1);
			$tmp['phone']			=$row->phone;
			$tmp['email']				=$row->email;
			$tmp['facebook']		=$row->facebook;
			$arr[]		=$tmp;
			echo json_encode($arr);
		}
		
		public function country(){
			$this->db->order_by("name","asc");
			$res = $this->db->get("mobile_country")->result_array();
			$arr = array();
			foreach ($res as $P){
				$tmp['name']   =$P['name'];
				$arr[] = $tmp;
			}
			echo json_encode($arr);
		}
		
		public function banner($str=""){
			$arr = array();
			$this->db->select("pkid");
			$this->db->where("name",$str);
			$rows = $this->db->get("mobile_customer")->row();
			//banner list
			$this->db->where("customer_pkid",$rows->pkid);
			$res = $this->db->get("mobile_banner")->result_array();
			foreach ($res as $index){
				$tmp['banner']		=$index['banner'];
				$arr[] = $tmp;
			}
			echo json_encode($arr);
		}
		
	}
?>